#include<cstdio>
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
int n,t;
int p[30],covers[2<<17],f[2<<17];
int main()
{
	while(1)
	{
		scanf("%d",&n);
		if(n==0)return 0;
		for(int i=0;i<n;i++)
		{
			p[i] = 1<<i;
			int m,q;
			scanf("%d",&m);
			for(int j=1;j<=m;j++)
			{
				scanf("%d",&q);
				p[i] |= (1<<q);
			}	
		}
		for(int i=0;i<(1<<n);i++)
		{
			covers[i] = 0;
			for(int j=0;j<n;j++)
			{
				if(i&(1<<j))
				{
					covers[i] |= p[j];
				}
			}
		}
		f[0] = 0;
		int all = (1<<n)-1;
		for(int i=1;i<(1<<n);i++)
		{
			f[i] = 0;
			for(int j=i;j;j=(j-1)&i)
			{
				if(covers[j]==all)
				{
					f[i] = max(f[i],f[i^j]+1);
				}
			}
		}
		printf("Case %d: %d\n",++t,f[all]);
	}
	return 0;
}
 